﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace ClearingGraphAutomaton.UserControls
{
    /// <summary>
    /// Double buffered panel.
    /// </summary>
    class DoubleBufferedPanel : Panel
    {
        /// <summary>
        /// Default constructor of the double buffered panel.
        /// </summary>
        public DoubleBufferedPanel()
        {
            // Set the value of the double-buffering style bits to true.
            this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
            this.UpdateStyles();
        }

        protected override void OnMouseWheel(MouseEventArgs e)
        {
            if (this.MouseWheelNoScroll != null)
            {
                this.MouseWheelNoScroll(this, e);
            }
            else base.OnMouseWheel(e);
        }

        /// <summary>
        /// Occurs when the mouse wheel moves while the control has focus.
        /// </summary>
        public event MouseEventHandler MouseWheelNoScroll;
    }
}
